package com.hele.sts.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DbClose
{
  public static void freeConnection(Connection conn)
  {
    try
    {
      if (conn != null) {
        conn.close();
      }
    }
    catch (SQLException e)
    {
      e.printStackTrace();
    }
  }
  
  public static void freePreparedStatement(PreparedStatement pstmt)
  {
    try
    {
      if (pstmt != null) {
        pstmt.close();
      }
    }
    catch (SQLException e)
    {
      e.printStackTrace();
    }
  }
  
  public static void freeStatement(Statement stmt)
  {
    try
    {
      if (stmt != null) {
        stmt.close();
      }
    }
    catch (SQLException e)
    {
      e.printStackTrace();
    }
  }
  
  public static void freeResultSet(ResultSet rs)
  {
    try
    {
      if (rs != null) {
        rs.close();
      }
    }
    catch (SQLException e)
    {
      e.printStackTrace();
    }
  }
}
